home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Graphics⁄Sound / CTalk / CTalk.c < prev    next >
Text File  |  1990-08-09  |  1KB  |  52 lines

  1. /*CTalk talking class methods definition by Dmitri Linde <dmitri@bolvan.ph.utexas.edu>*/
  2.  
  3. #include "CTalk.h"
  4.  
  5. /*Init CTalk*/
  6. void CTalk::ITalk(void)
  7. {
  8. Sex                theSex        =Male;        
  9. FOMode            theMode        =Natural;    
  10. int                theRate        =150;        
  11. int                thePitch    =100;    
  12.  
  13.     speechFlag=TRUE;
  14.     if (SpeechOn(ExcpsFile,&theSpeech)!=0)
  15.         speechFlag=FALSE;
  16. }
  17. /*Method to say a string*/
  18. /*Note s[256] mus be a pascal string*/
  19. void CTalk::Say(char s[256])
  20. {
  21.     if (speechFlag==TRUE)
  22.     {
  23.         Phonemes=NewHandle(0);
  24.         TextLength=(long)s[0];
  25.         Result= Reader(theSpeech,&s[1],TextLength,Phonemes);
  26.         Result= MacinTalk(theSpeech,Phonemes);
  27.         DisposHandle(Phonemes);    
  28.     }
  29. }
  30. /*Check to see if MacinTalk is in System folder*/
  31. /*Use this method after ITalk()*/
  32. Boolean CTalk::Installed(void)
  33. {
  34.         return(speechFlag);
  35. }
  36. /*Dispose of speech*/
  37. void CTalk::Dispose(void)
  38. {
  39.         if (speechFlag==TRUE) 
  40.         SpeechOff(theSpeech);
  41.         delete(this);
  42. }
  43. /*Set talking rate in words per minute*/
  44. void CTalk::SetRate(int r)
  45. {
  46.     SpeechRate(theSpeech,r);
  47. }
  48. /*Set speach pitch*/
  49. void CTalk::SetPitch(int p)
  50. {
  51.     SpeechPitch(theSpeech,p,Male);
  52. }